strana 162
----------


strana 162
----------

strana 162
----------




strana 177
----------
<Image Width="300" Source="blythe.jpg">
  <Image.Effect> 
    <BlurEffect Radius="8"></BlurEffect>
  </Image.Effect> 
</Image>


<StackPanel>
  <Image Width="300" Source="blythe.jpg">
    <Image.Effect> 
      <BlurEffect Radius="{Binding Value, ElementName=Potenciometer, 
        Mode=OneWay}">
      </BlurEffect> 
    </Image.Effect> 
  </Image>

  <Slider Width="300" x:Name="Potenciometer"/>
</StackPanel>



strana 178
----------
<StackPanel>
  <TextBlock Margin="20">Pklad rozosten tlatka</TextBlock>
  <TextBox Margin="20"></TextBox>
  <Button Margin="10" Content="OK" Width="100" >
    <Button.Effect> 
      <BlurEffect Radius="6"></BlurEffect> 
    </Button.Effect>
  </Button>
</StackPanel>



<Image Width="300" Source="blythe.jpg">  
  <Image.Effect> 
    <DropShadowEffect BlurRadius="30" Color="Purple" 
      Direction="-45" Opacity="0.5" ShadowDepth="40"> 
    </DropShadowEffect> 
  </Image.Effect>  
</Image>  




strana 179
----------
<TextBlock  Text="Hello Silverlight!" FontSize="50" >
  <TextBlock.Effect>
    <DropShadowEffect ShadowDepth="6"/>
  </TextBlock.Effect>
</TextBlock>


<Image Source="Blythe.jpg" Width="300" >
  <Image.Clip>
    <EllipseGeometry RadiusX="100" RadiusY="200" Center="150,200"/>
  </Image.Clip>
</Image>



strana 181
----------
<Image Source="Nice124.JPG">
  <Image.Projection>
    <PlaneProjection RotationX="0" RotationY="-50" RotationZ="0">
    </PlaneProjection>
  </Image.Projection>
</Image>



<Grid x:Name="LayoutRoot" Background="White">
  <MediaElement x:Name="me" Stretch="None" 
    Source="Windows7VHDBoot.wmv">
  </MediaElement>
</Grid> 



strana 183
----------
<Grid x:Name="LayoutRoot" Background="White">
  <StackPanel Margin="35" Background="LightGray">
    <StackPanel.Projection>
      <PlaneProjection RotationX="-25" RotationY="-35" 
        RotationZ="15" />
    </StackPanel.Projection>

    <TextBlock Margin="20">Pklad 3D transformace formule
    </TextBlock>
    <TextBox Margin="20"></TextBox>
    <Button Margin="10" Content="OK" Width="100" />
  </StackPanel>
</Grid>


strana 185
----------
<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SilverlightApp.MainPage"
  Width="640" Height="480">

  <Grid x:Name="LayoutRoot" Background="White">
    <StackPanel>
      <Image x:Name="image1" Height="400" Source="pcr.jpg" Stretch="None">
        <Image.Projection>
          <PlaneProjection x:Name="Rotate" RotationY="45"/>
        </Image.Projection>
      </Image>
      <Slider Value="{Binding RotationY, Mode=TwoWay, 
        ElementName=Rotate}" Minimum="0" Maximum="360"/>
    </StackPanel>
  </Grid>
</UserControl>


strana 186
----------
<Grid x:Name="LayoutRoot" Background="Gray">
  <Border>
    <Grid Margin="10" Width="300" Height="200" Background="Aquamarine">
      <!-- Prvky zapouzden ve vizulnm kontejneru -->
    </Grid>

    <Border.Projection>
      <PlaneProjection x:Name="Projection" CenterOfRotationX="0.5"
        CenterOfRotationY="0.5" CenterOfRotationZ="0.5" />
    </Border.Projection>
  </Border>

  <StackPanel Width="300">
    <Slider x:Name="XSlider" Margin="10" Minimum="-360" Maximum="360" 
      SmallChange="1" Value="{Binding RotationX, Mode=TwoWay, 
      ElementName=Projection}" />
    <Slider x:Name="YSlider" Margin="10" Minimum="-360" Maximum="360" 
      SmallChange="1" Value="{Binding RotationY, Mode=TwoWay, 
      ElementName=Projection}" />
    <Slider x:Name="ZSlider" Margin="10" Minimum="-360" Maximum="360" 
      SmallChange="1" Value="{Binding RotationZ, Mode=TwoWay, 
      ElementName=Projection}" />
  </StackPanel>
</Grid>


strana 188
----------
<Grid x:Name="LayoutRoot" Background="White">

  <Image x:Name="i1" Height="320" Margin="150,20" Source="be1.jpg" >
    <Image.Projection>
      <PlaneProjection x:Name="i1Proj" 
        CenterOfRotationZ="-280" RotationY="0" />
    </Image.Projection>
  </Image>

  <Image x:Name="i2" Height="320" Margin="150,20" Source="be2.jpg" >
    <Image.Projection>
      <PlaneProjection x:Name="i2Proj" 
        CenterOfRotationZ="-280" RotationY="60" />
    </Image.Projection>
  </Image>

  <Image x:Name="i3" Height="320" Margin="150,20" Source="be3.jpg" >
    <Image.Projection>
      <PlaneProjection x:Name="i3Proj" 
        CenterOfRotationZ="-280" RotationY="120" />
    </Image.Projection>
  </Image>

  <Image x:Name="i4" Height="320" Margin="150,20" Source="be4.jpg" >
    <Image.Projection>
      <PlaneProjection x:Name="i4Proj" 
        CenterOfRotationZ="-280" RotationY="180" />
    </Image.Projection>
  </Image>

  <Image x:Name="i5" Height="320" Margin="150,20" Source="be5.jpg" >
    <Image.Projection>
      <PlaneProjection x:Name="i5Proj" 
        CenterOfRotationZ="-280" RotationY="240" />
    </Image.Projection>
  </Image>

  <Image x:Name="i6" Height="320" Margin="150,20" Source="be6.jpg" >
    <Image.Projection>
      <PlaneProjection x:Name="i6Proj" 
        CenterOfRotationZ="-280" RotationY="300" />
    </Image.Projection>
  </Image>
</Grid>





strana 190
----------
C#:
public Point pt;

public MainPage()
{
  InitializeComponent();
  Loaded += new RoutedEventHandler(Page_Loaded);
}

void Page_Loaded(object sender, RoutedEventArgs e)
{
  LayoutRoot.MouseMove += new MouseEventHandler(Grid_MouseMove);
  CompositionTarget.Rendering += 
    new EventHandler(CompositionTarget_Rendering);
}

void Grid_MouseMove(object sender, MouseEventArgs e)
{
  pt = e.GetPosition(LayoutRoot);
}

void CompositionTarget_Rendering(object sender, EventArgs e)
{
  i1Proj.RotationY += ((pt.X - (LayoutRoot.ActualWidth / 2)) / 
    LayoutRoot.ActualWidth) * 10;
  i2Proj.RotationY += ((pt.X - (LayoutRoot.ActualWidth / 2)) / 
    LayoutRoot.ActualWidth) * 10;
  i3Proj.RotationY += ((pt.X - (LayoutRoot.ActualWidth / 2)) / 
    LayoutRoot.ActualWidth) * 10;
  i4Proj.RotationY += ((pt.X - (LayoutRoot.ActualWidth / 2)) / 
    LayoutRoot.ActualWidth) * 10;
  i5Proj.RotationY += ((pt.X - (LayoutRoot.ActualWidth / 2)) / 
    LayoutRoot.ActualWidth) * 10;
  i6Proj.RotationY += ((pt.X - (LayoutRoot.ActualWidth / 2)) / 
    LayoutRoot.ActualWidth) * 10;

  i1.Opacity = (pt.Y / LayoutRoot.ActualHeight) * 0.5 + 0.5;
  i2.Opacity = (pt.Y / LayoutRoot.ActualHeight) * 0.5 + 0.5;
  i3.Opacity = (pt.Y / LayoutRoot.ActualHeight) * 0.5 + 0.5;
  i4.Opacity = (pt.Y / LayoutRoot.ActualHeight) * 0.5 + 0.5;
  i5.Opacity = (pt.Y / LayoutRoot.ActualHeight) * 0.5 + 0.5;
  i6.Opacity = (pt.Y / LayoutRoot.ActualHeight) * 0.5 + 0.5;
}




strana 191
----------
<Grid x:Name="LayoutRoot" Background="White">

<Canvas Margin="150,100,150,200">

  <Ellipse Height="1000" Width="1000" Opacity="0.75" 
    RenderTransformOrigin="0.5,0.5" Canvas.Top="-10">
    <Ellipse.RenderTransform>
      <TransformGroup>
        <ScaleTransform ScaleX="0.05" ScaleY="0.2"/>
        <TranslateTransform X="-400" Y="-300"/>
      </TransformGroup>
    </Ellipse.RenderTransform>

    <Ellipse.Fill>
      <RadialGradientBrush>
        <GradientStop Color="Black" Offset="0.5"/>
        <GradientStop Offset="1"/>
      </RadialGradientBrush>
    </Ellipse.Fill>

    <Ellipse.Projection>
      <PlaneProjection x:Name="Stin" GlobalOffsetY="280" 
        GlobalOffsetZ="350" RotationX="440" LocalOffsetY="-160" 
        LocalOffsetZ="-200"/>
    </Ellipse.Projection>
  </Ellipse>

  <Ellipse Height="200" Width="200">
    <Ellipse.Fill>
      <RadialGradientBrush x:Name="Svetlo" GradientOrigin="0.25,0.25">
        <GradientStop Color="White" Offset="0.05"/>
        <GradientStop Color="LightCyan" Offset="0.2"/>
        <GradientStop Color="Cyan" Offset="0.5"/>
        <GradientStop Color="Blue" Offset="0.9"/>
        <GradientStop Color="Black" Offset="1"/>
      </RadialGradientBrush>
    </Ellipse.Fill>
  </Ellipse>
</Canvas>
</Grid>


strana 192
----------
C#:
public Point pt;

public MainPage()
{
  InitializeComponent();
  LayoutRoot.MouseMove += new MouseEventHandler(LayoutRoot_MouseMove);
}

void LayoutRoot_MouseMove(object sender, MouseEventArgs e)
{
  pt = e.GetPosition(LayoutRoot);
  pt.X /= 500;  pt.Y /= 500;
  Svetlo.GradientOrigin = pt;
  pt.X -= (pt.X * 2);
  pt.X += 1;
  pt.X *= 1000;
  pt.X -= 500;
  Stin.LocalOffsetX = pt.X;
  pt.Y -= (pt.Y * 2);
  pt.Y += 1;
  pt.Y *= 500;
  pt.Y -= 500;
  Stin.LocalOffsetY = pt.Y;




strana 203
----------
<Grid x:Name="LayoutRoot" Background="White">
  <Border BorderThickness="5"  BorderBrush="Blue" 
    VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
    <MultiScaleImage Source="DeepZoom/dzc_output.xml" 
      x:Name="DeepZoom" />
  </Border>
</Grid>



strana 204
----------
<Border BorderThickness="5"  BorderBrush="Blue" 
  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" >
  <MultiScaleImage Source="DeepZoom/dzc_output.xml" x:Name="msiVegas" 
    MouseEnter="DeepZoomObject_MouseEnter" 
    MouseLeave="DeepZoomObject_MouseLeave"/>
</Border> 



C#:
private void DeepZoomObject_MouseEnter(object sender, MouseEventArgs e)
{
  this.msiVegas.ZoomAboutLogicalPoint(6, .99, .03);
}

private void DeepZoomObject_MouseLeave(object sender, MouseEventArgs e)
{
  double zoom = 1;
  zoom = zoom / 6;
  this.msiVegas.ZoomAboutLogicalPoint(zoom, .99, .03);
}


strana 205
----------
<Grid x:Name="LayoutRoot" Background="White">
  <Grid.RowDefinitions>
    <RowDefinition Height="*"/>
    <RowDefinition Height="80"/>
  </Grid.RowDefinitions>

  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="*"/>
    <ColumnDefinition Width="64"/>
    <ColumnDefinition Width="64"/>
    <ColumnDefinition Width="64"/>
  </Grid.ColumnDefinitions>

  <MultiScaleImage Source='DeepZoom/dzc_output.xml' 
    x:Name='msiVegas' 
    MouseLeftButtonDown="msiVegas_MouseLeftButtonDown" 
    MouseLeftButtonUp="msiVegas_MouseLeftButtonUp" 
    MouseMove="msiVegas_MouseMove" 
    ImageOpenSucceeded="msiVegas_ImageOpenSucceeded" 
    MotionFinished="msiVegas_MotionFinished" 
    Grid.Column="0" Grid.ColumnSpan="4" 
    Grid.Row="0" Grid.RowSpan="2" />

  <Image Source="home.png" MouseLeftButtonUp="Home_Click" 
    x:Name='Home' Grid.Row="1" Grid.Column="1" ></Image>
  <Image Source="zoomin.png" MouseLeftButtonUp="ZoomIn_Click" 
    x:Name='ZoomIn' Grid.Row="1" Grid.Column="2" ></Image>
  <Image Source="zoomout.png" MouseLeftButtonUp="ZoomOut_Click" 
    x:Name='ZoomOut' Grid.Row="1" Grid.Column="3"></Image>
</Grid>



strana 206
----------
C#:
Point ptLastMouse = new Point();
Point ptView = new Point();
bool bOpen = false; 
bool bDrag = false;
double dZoom = 1;

public MainPage()
{
  InitializeComponent();
}

private void Home_Click(object sender, MouseButtonEventArgs e)
{
  this.msiVegas.ViewportOrigin = new Point(0, 0);
  this.msiVegas.ViewportWidth = 1;
  dZoom = 1;
}

private void ZoomIn_Click(object sender, MouseButtonEventArgs e)
{
  Zoom(1);
}

private void ZoomOut_Click(object sender, MouseButtonEventArgs e)
{
  Zoom(-1);
}

void Zoom(int delta)
{
  double newzoom;
  if (delta > 0) newzoom = dZoom / 1.5;
  else newzoom = dZoom * 1.5;

  Point logicalPoint = this.msiVegas.ElementToLogicalPoint(new 
    Point(this.ActualWidth / 2, this.ActualHeight / 2));
  this.msiVegas.ZoomAboutLogicalPoint(dZoom / newzoom, 
    logicalPoint.X, logicalPoint.Y);
  dZoom = newzoom;
}

private void msiVegas_MouseLeftButtonDown(object sender, 
  MouseButtonEventArgs e)
{
  ptLastMouse = e.GetPosition(this.msiVegas);
  ptView = this.msiVegas.ViewportOrigin;
  bDrag = true;
}

private void msiVegas_MouseLeftButtonUp(object sender, 
  MouseButtonEventArgs e)
{
  bDrag = false;
  this.msiVegas.UseSprings = true;
}

private void msiVegas_MouseMove(object sender, MouseEventArgs e)
{
  if (bDrag)
  {
    Point newPoint = ptView;
    Point ptActMouse = e.GetPosition(this.msiVegas);
    newPoint.X += (ptLastMouse.X - ptActMouse.X) / 
      this.msiVegas.ActualWidth * this.msiVegas.ViewportWidth;
    newPoint.Y += (ptLastMouse.Y - ptActMouse.Y) / 
      this.msiVegas.ActualWidth * this.msiVegas.ViewportWidth;
    this.msiVegas.ViewportOrigin = newPoint;
  }
}

private void msiVegas_ImageOpenSucceeded(object sender, 
  RoutedEventArgs e)
{
  bOpen = true;

}

private void msiVegas_MotionFinished(object sender, 
  RoutedEventArgs e)
{
  if (bOpen)
  {
    bOpen = false;
    this.msiVegas.ViewportOrigin = new Point(-0.4, -0.1);
    this.msiVegas.ViewportWidth = 1.8;
  }
}



strana 209
----------
C#:

public MainPage()
{
  InitializeComponent();
  msiVegas.MouseWheel += new MouseWheelEventHandler(msiVegas_MouseWheel);
}

void msiVegas_MouseWheel(object sender, MouseWheelEventArgs e)
{
  Zoom(e.Delta);
}


